function showDialog(dlgid, modal){
	var dlg = $('#'+dlgid).removeClass('hide');
	var dlgbg = $('#'+dlgid+'_bg');
	if(dlgbg.length==0){
		dlgbg = $('<div id="'+dlgid+'_bg" class="dlgbg dlgbdr"></div>').appendTo(document.body);
	}
	dlgbg.removeClass('hide');
	var doc = $(document);
	var x = (doc.width() - dlg.width()) / 2;
	var y = (doc.height() - dlg.height()) * 0.3;
	dlgbg.width(dlg.width()+8).height(dlg.height()+8).css({left:x+'px',top:y+'px'});
	dlg.css({'left':(x+4)+'px',top:(y+4)+'px'});
	if(modal){
		var dlgover = $('#dialog_overlap');
		if(dlgover.length==0)
			dlgover = $('<div id="dialog_overlap" class="dlgover"></div>').appendTo(document.body);
		dlgover.removeClass('hide');
	}
}

function hideDialog(dlgid){
	$('#'+dlgid).addClass('hide');
	$('#'+dlgid+'_bg').addClass('hide');
	$('#dialog_overlap').addClass('hide');
}